﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Smile.Mvvm.Service
{
    /// <summary>
    ///     Service interface which manage operations with the application settings storage.
    /// </summary>
    public interface ISettingsService
    {
        // @Indexer
        object this[string key] { get; set; }

        // @Members function
        /// <summary>
        ///     Adds a setting. 
        ///     Note (Windows 8): Class are not suported exept string.
        /// </summary>
        ///
        /// <param name="key">  The key.</param>
        /// <param name="value">The value.</param>
        void Add(string key, object value);

        /// <summary>Query if the settings contains the given key.</summary>
        ///
        /// <param name="key">The key.</param>
        ///
        /// <returns>true if the object is in this collection, false if not.</returns>
        bool Contains(string key);

        /// <summary>Removes the setting associated with the given key.</summary>
        ///
        /// <param name="key">The key.</param>
        void Remove(string key);

        /// <summary>Try get value associated to the given key.</summary>
        ///
        /// <typeparam name="T">Generic type parameter.</typeparam>
        /// <param name="key">  The key.</param>
        /// <param name="value">The value.</param>
        ///
        /// <returns>true if it succeeds, false if it fails.</returns>
        bool TryGetValue<T>(string key, out T value);
    }
}
